import {  Controller, Get, Inject, Query } from '@midwayjs/core'
import { Context } from '@midwayjs/koa'
import { LoginService } from '../service/login'


@Controller('/api/login')
export class LoginController {

  @Inject()
  ctx: Context;

  @Inject()
  loginService: LoginService;

  @Get('/',{summary:'登录'})
  async init(){
    return 'Hello Midwayjs!';
  }

  @Get('/captcha',{summary:'获取验证码'})
  async captcha(@Query('type') type:string,@Query('width') width:number,@Query('height') height:number){
    console.log('Width:', width);
    console.log('Height:', height);
    return this.loginService.captcha(type,width,height);
  }
}